import { defineStore } from 'pinia';
import { initColumns } from '@/views/dp_platform/qiangua.api';

interface IOptions {
  label: string;
  value: string;
}
interface IDpColumnsState {
  qianguaColumns: Array<IOptions>;
  pgyColumns: Array<IOptions>;
}
export const useDpColumnsStore = defineStore({
  id: 'app-dp-columns',
  state: (): IDpColumnsState => ({
    qianguaColumns: [],
    pgyColumns: [],
  }),
  getters: {
    getQianguaColumns(state): Array<IOptions> {
      return state.qianguaColumns;
    },
    getPgyColumns(state): Array<IOptions> {
      return state.pgyColumns;
    },
  },
  actions: {
    async initDpColumns() {
      const res = await initColumns();
      this.qianguaColumns = res.qianguaColumns;
      this.pgyColumns = res.pgyColumns;
    },
  },
});
